/*    */ package handling.world.party;
/*    */ 
/*    */ import handling.world.WorldPartyService;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ 
/*    */ 
/*    */ public class MapleExpedition
/*    */ {
/*    */   private final List<Integer> parties;
/*    */   private final ExpeditionType type;
/*    */   private final int id;
/*    */   private int leaderId;
/*    */   
/*    */   public MapleExpedition(ExpeditionType etype, int leaderId, int id) {
/* 16 */     this.type = etype;
/* 17 */     this.id = id;
/* 18 */     this.leaderId = leaderId;
/* 19 */     this.parties = new ArrayList<>(etype.maxParty);
/*    */   }
/*    */   
/*    */   public ExpeditionType getType() {
/* 23 */     return this.type;
/*    */   }
/*    */   
/*    */   public int getLeader() {
/* 27 */     return this.leaderId;
/*    */   }
/*    */   
/*    */   public void setLeader(int newLead) {
/* 31 */     this.leaderId = newLead;
/*    */   }
/*    */   
/*    */   public List<Integer> getParties() {
/* 35 */     return this.parties;
/*    */   }
/*    */   
/*    */   public int getId() {
/* 39 */     return this.id;
/*    */   }
/*    */   
/*    */   public int getAllMembers() {
/* 43 */     int ret = 0;
/* 44 */     for (int i = 0; i < this.parties.size(); i++) {
/* 45 */       MapleParty pp = WorldPartyService.getInstance().getParty(((Integer)this.parties.get(i)).intValue());
/* 46 */       if (pp == null) {
/* 47 */         this.parties.remove(i);
/*    */       } else {
/* 49 */         ret += pp.getMembers().size();
/*    */       } 
/*    */     } 
/* 52 */     return ret;
/*    */   }
/*    */   
/*    */   public int getFreeParty() {
/* 56 */     for (int i = 0; i < this.parties.size(); i++) {
/* 57 */       MapleParty party = WorldPartyService.getInstance().getParty(((Integer)this.parties.get(i)).intValue());
/* 58 */       if (party == null) {
/* 59 */         this.parties.remove(i);
/* 60 */       } else if (party.getMembers().size() < 6) {
/* 61 */         return party.getPartyId();
/*    */       } 
/*    */     } 
/* 64 */     if (this.parties.size() < this.type.maxParty) {
/* 65 */       return 0;
/*    */     }
/* 67 */     return -1;
/*    */   }
/*    */   
/*    */   public int getIndex(int partyId) {
/* 71 */     for (int i = 0; i < this.parties.size(); i++) {
/* 72 */       if (((Integer)this.parties.get(i)).intValue() == partyId) {
/* 73 */         return i;
/*    */       }
/*    */     } 
/* 76 */     return -1;
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\handling\world\party\MapleExpedition.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */